package com.tmt.im.manager.config.beans;

import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.session.Session;
import org.springframework.session.security.SpringSessionBackedSessionRegistry;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/7/29 21:44
 * @Version 1.0
 **/
public class MySpringSessionBackedSessionRegistry<S extends Session> extends SpringSessionBackedSessionRegistry<S> {

    public MySpringSessionBackedSessionRegistry(FindByIndexNameSessionRepository<S> sessionRepository) {
        super(sessionRepository);
    }

    @Override
    protected String name(Object principal) {
        if (principal instanceof String) {
            return (String) principal;
        }
        return super.name(principal);
    }
}
